﻿#include "GraphVTKObjectModelBase.h"
#include "GraphVTKObjectHighlighting.h"

// VTK
#include <vtkMapper.h>
#include <vtkActor.h>
#include <vtkProperty.h>

namespace Exchange {

    GraphVTKObjectModelBase::GraphVTKObjectModelBase(Core::FITKAbstractDataObject* dataObj)
        : GraphVTKObject3D(dataObj)
    {
        // 设置是否有固定边界
        m_hasFixedBounds = true;

        init();
    }
    void GraphVTKObjectModelBase::init()
    {
        // 创建高亮对象
        m_graphObjHighlight = new GraphVTKObjectHighlighting(_dataObj);

        if (m_graphObjHighlight)
        {
            m_graphObjHighlight->setRepresentation(1);
            m_graphObjHighlight->setColor(GraphVTKCommons::s_highlightColor);
            m_graphObjHighlight->setVisible(false);
            addAddinGraphObject(m_graphObjHighlight);
        }
    }

    void GraphVTKObjectModelBase::highlight(QColor color)
    {
        if (!m_graphObjHighlight || !getDataVisibility())
            return;

        m_graphObjHighlight->highlight(color);
        this->Superclass::highlight(color);
    }

    void GraphVTKObjectModelBase::disHighlight()
    {
        if (m_graphObjHighlight && _isHighlighting)
            m_graphObjHighlight->disHighlight();
        this->Superclass::disHighlight();
    }

}